UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z8dzpY0T5IeFlzJ+JkfNx1cBStRtgQBgZJRdTMn0E9M=' 
WHERE 
  key_id = 'bf4c4f26d3476cd867b54acd7638a643f37390444d099e265435880737bd55bb' 
  AND (
    token = 'Z8dzpY0T5IeFlzJ+JkfNx1cBStRtgQBgZJRdTMn0E9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034