UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3fb65ISBs6B7TEs7QHQlMQTgH5TobrifvHsS2rr+Zwk=' 
WHERE 
  key_id = '7977d7dd080872e2be940ac464699d65080f65cc4f9b73a90baec9f54b5a9981' 
  AND (
    token = '3fb65ISBs6B7TEs7QHQlMQTgH5TobrifvHsS2rr+Zwk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016