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