UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3ACThfGzPYQGIuz82WA/FT0h6JlGWHTMmkn7teU0Hs4=' 
WHERE 
  key_id = '9713f5ac3a69d9152d2fca450b776154cb00d7fa278857cc2d6de38208302a48' 
  AND (
    token = '3ACThfGzPYQGIuz82WA/FT0h6JlGWHTMmkn7teU0Hs4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028