UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ePbelDn6y5+Jb0pdBTvQySfJJz+YW34cbQX9VO2ujo8='
WHERE
key_id = '229ab47043b9a36c1cc95cf4d111b4896ddff8eb7281b7e6adfcd96ddee1009c'
AND (
token = 'ePbelDn6y5+Jb0pdBTvQySfJJz+YW34cbQX9VO2ujo8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)