UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iV19aD5XJGlUjMZdYFawgVr5q+aUWmIQY3SgmtjC05k='
WHERE
key_id = '1aa189405f4f8df1f222204d9916cf044fa197a5d2c924299f35e9056aa4197b'
AND (
token = 'iV19aD5XJGlUjMZdYFawgVr5q+aUWmIQY3SgmtjC05k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)