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