UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NYz5NUoDDwu5fcBp94vJVwzrZthFzOWu0ulGLQnjWB4='
WHERE
key_id = '005aa890cd2830d3ba2221909a03d1e72d830b898cce4b5048a77fe288c1e40d'
AND (
token = 'NYz5NUoDDwu5fcBp94vJVwzrZthFzOWu0ulGLQnjWB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)