UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8Z3SAn5iI4RjyPK7puKCs0Hl3a0VsM71A2zPJzL4iaQ=' 
WHERE 
  key_id = '59e7f452febe9e4053bdcadb291a1cf351c8799168474ba56b8be25c810d7e22' 
  AND (
    token = '8Z3SAn5iI4RjyPK7puKCs0Hl3a0VsM71A2zPJzL4iaQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044