UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'efy1fwC3dHBMoNlj8LTh2No3kIJmdFFqAPX94+0H8Aw='
WHERE
key_id = '3f67f270a8a666eec6e551836f2fb794ca7d19788b75e7c5793d9a1535dc8c1e'
AND (
token = 'efy1fwC3dHBMoNlj8LTh2No3kIJmdFFqAPX94+0H8Aw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)