UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ivfOdtMmwptYxYG5aFgElpl5UwpeN2ZJf03GBlT3FAc=' 
WHERE 
  key_id = '4d4120842ac3062365e8c59e33cda848d0563a1736ad9fed3c979d95f487ab63' 
  AND (
    token = 'ivfOdtMmwptYxYG5aFgElpl5UwpeN2ZJf03GBlT3FAc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028