UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'trNlMcKVghg0PzZAungJdT1bL+9Lu47LYNY3D76pWb0=' 
WHERE 
  key_id = 'bf1834899e2bb196a6686fc8210501fe23aa9d560c1e1af84d1c592872780d0d' 
  AND (
    token = 'trNlMcKVghg0PzZAungJdT1bL+9Lu47LYNY3D76pWb0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040