UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ckcf1r5Xv3LcJPWl7Bz8XpKeXdELQM3b8MfIpMHc1+8='
WHERE
key_id = '7d28f31f919ff7d8115f1f2d00475d33b4171154cefbbe779b5effb844f4e0c8'
AND (
token = 'ckcf1r5Xv3LcJPWl7Bz8XpKeXdELQM3b8MfIpMHc1+8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)