UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0XY0QdjkBq5dbL0uPku3HVnI1Xk/N3NmFrcD0g64QX4='
WHERE
key_id = 'a3913918f9906a584b2bbd9604e7c1c45d01d5cab2f3d6dd980ffca10532edef'
AND (
token = '0XY0QdjkBq5dbL0uPku3HVnI1Xk/N3NmFrcD0g64QX4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)