UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TR0TbzQImQ1YZsxttBIhpyLEM7q82OHaFqw2kEPNueU='
WHERE
key_id = 'e7f57b99d82854b9f4d00b5b8bd1872a46d61ef0b86dce4d4d189dfbf88157ca'
AND (
token = 'TR0TbzQImQ1YZsxttBIhpyLEM7q82OHaFqw2kEPNueU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)