UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AbAEfbT+1MYUmqz9++OpWiE/EnX52ouNvTrVGCnTUU8='
WHERE
key_id = '74a03a7a4c5dced7f65f21901b662374a79793318ef6f3497a7977344e70b29c'
AND (
token = 'AbAEfbT+1MYUmqz9++OpWiE/EnX52ouNvTrVGCnTUU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)