UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BVUjXAeRlPwtHluMv5i5qYSHddlK9IwXqI7rIuFe7Js=' 
WHERE 
  key_id = '712fe6b28e42b09f70a0d74e7abd9dd5cf4ddc582178909d363e572c3b716081' 
  AND (
    token = 'BVUjXAeRlPwtHluMv5i5qYSHddlK9IwXqI7rIuFe7Js=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025