UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bZ12z8Ru9UqyDiNsYS8DPYHDCm+92cnr5+o4X+C7dSo='
WHERE
key_id = 'e1d9dea298a28f61c388b904688162c26cb46e20326db7ff95f3547a54f55417'
AND (
token = 'bZ12z8Ru9UqyDiNsYS8DPYHDCm+92cnr5+o4X+C7dSo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)