UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gjVFVN0gnVsIqDl1zgH5hROAreyHFiFXmvK5Yk9vdtY='
WHERE
key_id = 'a19a9c059742bd3b24012a1302bd59ea217fc7e20b13f50c2d1f311c3f35844f'
AND (
token = 'gjVFVN0gnVsIqDl1zgH5hROAreyHFiFXmvK5Yk9vdtY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)