UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EHPMJyuQVNNdGnHD8FU3+5bCynTnx941lWk0LbffeR8='
WHERE
key_id = '802c77ca8756a78475367832c3e9a497f6f0567dc995e20c7d889498c0b78a7f'
AND (
token = 'EHPMJyuQVNNdGnHD8FU3+5bCynTnx941lWk0LbffeR8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)