UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jzkozunSKGYXGmox8GIrYIzUs1mtYssJGg7mOjT+RFs=' 
WHERE 
  key_id = '341c5837cd4f715fb3cf5642b5823bc74da8b44d3ea903c07bb2ea5ed58b211f' 
  AND (
    token = 'jzkozunSKGYXGmox8GIrYIzUs1mtYssJGg7mOjT+RFs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050