UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4T8Giuxk3CUCGq4X09PAfFrIq6K4bxF9gmttmeaDy3k=' 
WHERE 
  key_id = 'cde984603e82e1e23cea24e51e6ee2fac7c5d33008c5465bab52c88161bbcd1c' 
  AND (
    token = '4T8Giuxk3CUCGq4X09PAfFrIq6K4bxF9gmttmeaDy3k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028