UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DSy7lHsQBNJVsvj1C38B4fyNv4jUVSIk4hmrdGpThZk=' 
WHERE 
  key_id = '6cde427a2911cbee1ca116cad79989e1780e15fe93bd9843c0cbc73093408595' 
  AND (
    token = 'DSy7lHsQBNJVsvj1C38B4fyNv4jUVSIk4hmrdGpThZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039