UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RSHbzNzRvq1Xwj8+8xTuYtC6VHkWF/0JP7tGs0meaik='
WHERE
key_id = 'f2040266fc78ea5644649b68d72bfe74a643a030c95fb78f577855e38738dfc5'
AND (
token = 'RSHbzNzRvq1Xwj8+8xTuYtC6VHkWF/0JP7tGs0meaik='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)