UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KG6LVEvyynSLCDfvxEzwKLIXN3viTdh8YbDgUUoWJ04=' 
WHERE 
  key_id = 'bbeba274718e97bb9b11330f62506eaa3ed5aa23aff4d4cbf67e3084a32643f7' 
  AND (
    token = 'KG6LVEvyynSLCDfvxEzwKLIXN3viTdh8YbDgUUoWJ04=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00368