UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N7OaxjyuHn0C3Nzbc7dNrLADi/QvBXo3ZD1orB+5+gE='
WHERE
key_id = '6daede5adf714ea6b165d03b6deecb1b49e3e6a330b1b6ab3616ffbace33aaad'
AND (
token = 'N7OaxjyuHn0C3Nzbc7dNrLADi/QvBXo3ZD1orB+5+gE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)