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