UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'owBTQY+KV3ZL6izsWdMYPxL7zTkRb4YrTGLI7ENmZ2k=' 
WHERE 
  key_id = '0fdef9a0787493eb6ea056f87561ccf457ce27c3ce1eb245df084b80e0ddd4d8' 
  AND (
    token = 'owBTQY+KV3ZL6izsWdMYPxL7zTkRb4YrTGLI7ENmZ2k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040