UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hyxRRULxZzW+pvYuYV2nB1jMdlqMiTLRmikHMpj+5tU=' 
WHERE 
  key_id = '52b154acb7828e62759cb9fe22a9eaa0fe99168d9e54ba31b60f6f28aa3321fd' 
  AND (
    token = 'hyxRRULxZzW+pvYuYV2nB1jMdlqMiTLRmikHMpj+5tU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050