UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C3kz6zaPnbyGTkzy5Yt/SgBawswjuyeob0YgU3jKQqc='
WHERE
key_id = 'fa4e540e7f8afbf2f9791ca0e70f1432d583003d47e1418447269c314f75357f'
AND (
token = 'C3kz6zaPnbyGTkzy5Yt/SgBawswjuyeob0YgU3jKQqc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)