UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8I3UjIauMH8S/WFjvO1W2kPHXbHjypSjX+SZ2fTmsgA=' 
WHERE 
  key_id = 'b5144d2fbf207255db4499d861eaa998ea7f1f255b8ddb5664e3060063f87694' 
  AND (
    token = '8I3UjIauMH8S/WFjvO1W2kPHXbHjypSjX+SZ2fTmsgA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037