UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6hZcjQv0vrkWuBmL6DA+BBxtWk7hNDZ4469TUpvcqD4='
WHERE
key_id = '5a0dcf1a7e602b5d5d8efadb0ec95450a1f2b3c0220cf2eaa655fc95225059ac'
AND (
token = '6hZcjQv0vrkWuBmL6DA+BBxtWk7hNDZ4469TUpvcqD4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)